@im-nobsidian/core 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -246,6 +246,8 @@ interface SyncRecord {
246
246
  readonly fileType: FileType;
247
247
  readonly status: SyncStatus;
248
248
  readonly baseSnapshot: Buffer | null;
249
+ readonly localMtime: string | null;
250
+ readonly localFileSize: number | null;
249
251
  readonly version: number;
250
252
  readonly createdAt: string;
251
253
  readonly updatedAt: string;
@@ -272,9 +274,14 @@ interface Conflict {
272
274
  readonly localContent: string;
273
275
  readonly remoteContent: string;
274
276
  }
275
- type ProgressCallback = (current: number, total: number, path: string) => void;
277
+ interface ProgressItem {
278
+ readonly path: string;
279
+ readonly operation: "create" | "update" | "delete";
280
+ }
281
+ type ProgressCallback = (current: number, total: number, item: ProgressItem) => void;
276
282
  interface PushOptions {
277
283
  readonly paths?: string[];
284
+ readonly excludePaths?: string[];
278
285
  readonly force?: boolean;
279
286
  readonly dryRun?: boolean;
280
287
  readonly onProgress?: ProgressCallback;
@@ -306,6 +313,9 @@ interface PullResult {
306
313
  readonly writtenPaths: string[];
307
314
  readonly failed: FailedOperation[];
308
315
  readonly duration: number;
316
+ readonly imageCount: number;
317
+ readonly fileCount: number;
318
+ readonly linkCount: number;
309
319
  }
310
320
  interface SyncResult {
311
321
  readonly push: PushResult;
@@ -468,6 +478,7 @@ declare class StateDB {
468
478
  updateStatus(id: string, status: SyncStatus): void;
469
479
  updateHash(id: string, hash: string, snapshot?: Buffer | null): void;
470
480
  setNotionLastEdited(id: string, lastEdited: string): void;
481
+ updateStatCache(id: string, mtime: string, fileSize: number): void;
471
482
  setNotionParentId(id: string, parentId: string): void;
472
483
  delete(id: string): void;
473
484
  resolveWikilink(text: string): WikilinkEntry | null;
@@ -498,6 +509,8 @@ interface UpsertSyncRecord {
498
509
  readonly fileType: SyncRecord["fileType"];
499
510
  readonly status: SyncRecord["status"];
500
511
  readonly baseSnapshot?: Buffer | null;
512
+ readonly localMtime?: string | null;
513
+ readonly localFileSize?: number | null;
501
514
  }
502
515
  interface FileRegistryEntry {
503
516
  readonly id: string;
@@ -597,6 +610,10 @@ declare class NotionClient {
597
610
  results: PageObjectResponse[];
598
611
  nextCursor: string | null;
599
612
  }>;
613
+ searchRecentPages(since: string): Promise<Array<{
614
+ id: string;
615
+ last_edited_time: string;
616
+ }>>;
600
617
  getChildPages(parentId: string): Promise<PageObjectResponse[]>;
601
618
  getChildDatabaseIds(parentId: string): Promise<string[]>;
602
619
  getChildPagesRecursive(parentId: string): Promise<PageObjectResponse[]>;
@@ -745,6 +762,7 @@ interface FileInfo {
745
762
  declare class ChangeDetector {
746
763
  private readonly stateDb;
747
764
  constructor(stateDb: StateDB);
765
+ detectLocalChangesFast(stats: FileStatInfo[], readFile: (path: string) => Promise<string>): Promise<LocalChange[]>;
748
766
  detectLocalChanges(currentFiles: FileInfo[]): LocalChange[];
749
767
  private detectMoves;
750
768
  }
@@ -754,6 +772,11 @@ interface NonMdFileInfo {
754
772
  readonly size: number;
755
773
  readonly mtime: string;
756
774
  }
775
+ interface FileStatInfo {
776
+ readonly path: string;
777
+ readonly mtime: string;
778
+ readonly size: number;
779
+ }
757
780
  interface VaultFS {
758
781
  readFile(path: string): Promise<string>;
759
782
  readBinary(path: string): Promise<Buffer>;
@@ -764,7 +787,9 @@ interface VaultFS {
764
787
  exists(path: string): Promise<boolean>;
765
788
  ensureFolder(path: string): Promise<void>;
766
789
  listMarkdownFiles(): Promise<FileInfo[]>;
790
+ listMarkdownFileStats(): Promise<FileStatInfo[]>;
767
791
  listNonMarkdownFiles(): Promise<NonMdFileInfo[]>;
792
+ getFileStat(path: string): Promise<FileStatInfo | null>;
768
793
  }
769
794
 
770
795
  declare class SyncOrchestrator {
@@ -780,14 +805,24 @@ declare class SyncOrchestrator {
780
805
  private readonly databaseSyncer;
781
806
  private readonly propertyMapper;
782
807
  private dbSchemaLoaded;
808
+ private _pullImageCount;
809
+ private _pullFileCount;
783
810
  constructor(config: Config, stateDb: StateDB, notionClient: NotionClient, vaultFs: VaultFS);
784
811
  push(options?: PushOptions): Promise<PushResult>;
785
812
  pull(options?: PullOptions): Promise<PullResult>;
786
813
  sync(options?: SyncOptions): Promise<SyncResult>;
787
814
  status(): Promise<StatusResult>;
815
+ statusLocal(): Promise<StatusResult>;
816
+ fetch(): Promise<{
817
+ newPages: number;
818
+ deletedPages: number;
819
+ modifiedPages: number;
820
+ duration: number;
821
+ }>;
788
822
  private buildConflictsFromRecords;
789
823
  private get isDatabaseMode();
790
824
  private discoverChildDatabases;
825
+ private pullDiscoveredDatabases;
791
826
  private resolveNotionLinks;
792
827
  private ensureDbSchema;
793
828
  private pushCreate;
@@ -795,16 +830,18 @@ declare class SyncOrchestrator {
795
830
  private pushDelete;
796
831
  private pushMove;
797
832
  private detectRemoteChanges;
833
+ private detectRemoteChangesIncremental;
834
+ private isTrackedParent;
798
835
  private pullCreate;
799
836
  private pullUpdate;
800
837
  private pullDelete;
801
838
  private ensureFolderPage;
802
839
  private resolveNotionParent;
840
+ private repairFolderRecords;
803
841
  private isFolderNote;
804
842
  private resolveParentPath;
805
843
  private pushCreatePage;
806
844
  private pushUpdatePage;
807
- private computePatches;
808
845
  private fetchPageMarkdown;
809
846
  private extractParentId;
810
847
  private resolveBlockToPageId;
@@ -831,10 +868,13 @@ declare class NodeVaultFS implements VaultFS {
831
868
  exists(path: string): Promise<boolean>;
832
869
  ensureFolder(path: string): Promise<void>;
833
870
  listMarkdownFiles(): Promise<FileInfo[]>;
871
+ listMarkdownFileStats(): Promise<FileStatInfo[]>;
872
+ getFileStat(path: string): Promise<FileStatInfo | null>;
834
873
  listNonMarkdownFiles(): Promise<NonMdFileInfo[]>;
835
874
  private matchesPattern;
836
875
  private isExcluded;
837
876
  private walkDirNonMd;
877
+ private walkDirStats;
838
878
  private walkDir;
839
879
  }
840
880
 
@@ -1306,4 +1346,4 @@ interface PipelineOptions {
1306
1346
  }
1307
1347
  declare function createDefaultPipeline(options?: PipelineOptions): ConversionPipeline;
1308
1348
 
1309
- export { BlockConverter, type CalendarEntry, CalloutRestorer, CalloutTransformer, ChangeDetector, ColorAnnotator, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, type CoverConfig, type DBEntry, DEFAULT_CONFIG, type DatabaseSyncConfig, type DatabaseSyncResult, DatabaseSyncer, type DatabaseViewsConfig, EmbedResolver, EntryEditor, type FailedOperation, type FileDownloadResult, FileHandler, type FileInfo, type FileSystemEntry, type FileType, type FileUploadResult, FileWatcher, FrontmatterExtractor, FrontmatterGenerator, type GroupByConfig, type GroupedEntries, HtmlAnnotationStripper, type ImageDownloadResult, ImageHandler, type ImageReference, InlineDBParser, type LocalChange, LocalImageRestorer, type Logger, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NodeVaultFS, type NonMdFileInfo, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionColor, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type OperationType, type PageCover, type PageCreationPlan, type PageIcon, type PathFilterConfig, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PropertyOption, type PropertySchema, type PropertyValue, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoteChange, type ResolutionChoice, type ResolutionResult, type RichTextSegment, StateDB, type StatusResult, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultFS, type ViewConfig, ViewDataProvider, type ViewPropertyConfig, type ViewRenderData, type ViewType, type WatchSyncOptions, WatchSyncService, type WikilinkEntry, WikilinkResolver, computeBufferHash, computeHash, createDefaultPipeline, extractCalendarEntries, filterByMonth, generateColorCSS, generateId, getLogger, getNotionBgColor, getNotionColor, getVisibleProperties, groupEntries, normalizeNotionId, notionIdsEqual, sanitizeFileName, setLogger, sortEntries, threeWayMerge };
1349
+ export { BlockConverter, type CalendarEntry, CalloutRestorer, CalloutTransformer, ChangeDetector, ColorAnnotator, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, type CoverConfig, type DBEntry, DEFAULT_CONFIG, type DatabaseSyncConfig, type DatabaseSyncResult, DatabaseSyncer, type DatabaseViewsConfig, EmbedResolver, EntryEditor, type FailedOperation, type FileDownloadResult, FileHandler, type FileInfo, type FileStatInfo, type FileSystemEntry, type FileType, type FileUploadResult, FileWatcher, FrontmatterExtractor, FrontmatterGenerator, type GroupByConfig, type GroupedEntries, HtmlAnnotationStripper, type ImageDownloadResult, ImageHandler, type ImageReference, InlineDBParser, type LocalChange, LocalImageRestorer, type Logger, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NodeVaultFS, type NonMdFileInfo, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionColor, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type OperationType, type PageCover, type PageCreationPlan, type PageIcon, type PathFilterConfig, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, type ProgressItem, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PropertyOption, type PropertySchema, type PropertyValue, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoteChange, type ResolutionChoice, type ResolutionResult, type RichTextSegment, StateDB, type StatusResult, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultFS, type ViewConfig, ViewDataProvider, type ViewPropertyConfig, type ViewRenderData, type ViewType, type WatchSyncOptions, WatchSyncService, type WikilinkEntry, WikilinkResolver, computeBufferHash, computeHash, createDefaultPipeline, extractCalendarEntries, filterByMonth, generateColorCSS, generateId, getLogger, getNotionBgColor, getNotionColor, getVisibleProperties, groupEntries, normalizeNotionId, notionIdsEqual, sanitizeFileName, setLogger, sortEntries, threeWayMerge };